package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.CartoonEveryDayPreviewDataBean;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;

import java.util.List;

/**
 * Created by hyy on 2018/5/10.
 */

public class CartoonTeacherEveryDayWordPreviewAdapter extends CommonRecycleViewAdapter<CartoonEveryDayPreviewDataBean.ResultBean.WordSpeakListBean> {
    public CartoonTeacherEveryDayWordPreviewAdapter(Context mContext, List<CartoonEveryDayPreviewDataBean.ResultBean.WordSpeakListBean> itemDatas) {
        super(mContext, R.layout.activity_everyday_preview_word, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final CartoonEveryDayPreviewDataBean.ResultBean.WordSpeakListBean item, final int position) {
        final SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);

        TextView text_name = customViewHold.getView(R.id.text_name);
        text_name.setText(item.getQuestionName());

        TextView time = customViewHold.getView(R.id.time);
        time.setText(item.getResourceDuration() + "''");


        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                clickCallBack.clickCallBack(item, simpleDraweeView,position);
            }
        });
    }

    public ClickCallBack getClickCallBack() {
        return clickCallBack;
    }

    public void setClickCallBack(ClickCallBack clickCallBack) {
        this.clickCallBack = clickCallBack;
    }

    private ClickCallBack clickCallBack;

    public interface ClickCallBack {
        abstract void clickCallBack(CartoonEveryDayPreviewDataBean.ResultBean.WordSpeakListBean item, SimpleDraweeView simpleDraweeView, int position);
    }
}
